Skip to main content link. Accesskey S
  • Help
  • HCL Logo
  • HCL Lotus Expeditor wiki
  • THIS WIKI IS READ-ONLY. Individual names altered for privacy purposes.
  • HCL forums and blogs
  • Home
  • Product Documentation
  • Community Articles
Search
Community Articles > Expeditor Client for Desktop > Sample: Client for Desktop Synchronization
  • Share Show Menu▼
  • Subscribe Show Menu▼

Recent articles by this author

Sample: Toolbar and Menu Contributions

Expeditor user interface team best practices on toolbar and menu contributions

Sample: Component Properties

OverviewComponent properties allow developers to create code that at compile time has specific function but accepts flexible input at runtime. For example, a developer can create a component that uses a predefined component property to update the title tab's text within a composite ...

Sample: Multiuser Features

Overview When multiple users share the same workstation, the configuration is referred to as a multiuser installation. This means that a single Expeditor client exists and is shared among all users; however, each user has their own workspace containing configuration details specific to that ...

Sample: Starting Plugins

Overview By default, Eclipse plugins are lazy. Lazy is the technical term (located in the bundle's manifest) that means that plugins are started when a request is either directly made by the Platform to start the plugin or indirectly through class loading. For example, the latter case implies ...

Sample: HTTP Communication

Overview The enhanced HTTP client in Expeditor allows developers to quickly create code that requests data from remote servers over HTTP or HTTPS. The enhanced client wraps the standard Java URLConnectionclasses such that authenticated requests leverage the Accounts framework and HTTPS ...
Community articleSample: Client for Desktop Synchronization
Added by ~Tip Desachekli | Edited by ~Tip Desachekli on April 13, 2011 | Version 13
  • Actions Show Menu▼
expanded Abstract
collapsed Abstract
Synchronization involves updating the desktop client with information such as managed settings and composite applications. The desktop client offers an API to control synchronization as well as out of the box features.
Tags: samples, synchronization
ShowTable of Contents
HideTable of Contents
  • 1 Overview
  • 2 Synchronizing Programmatically
  • 3 Receiving Synchronization Events
  • 4 Synchronization Details

Overview


The Expeditor Client for Desktop may be paired with additional components to provide synchronization services. Most commonly, the client is paired with an IBM WebSphere Portal server. The server allows delivery of managed settings (preferences) to the client as well as delivery of Composite Applications.

Synchronizing Programmatically


Synchronization can be accomplished using the SyncManager.

private static Logger logger = Logger.getLogger(SyncSampleManager.class
			.getName());

private static final SyncManager syncManager = SyncManagerFactory
			.getSyncManager(); 

private static SyncJobId jobId;

public static void syncAll() {
		try {
			jobId = syncManager.syncAll(SyncManager.NORMAL_PRIORITY_FILTERNAME);
		} catch (SyncException e) {
			logger.log(Level.SEVERE, "Error syncing using "
					+ SyncManager.NORMAL_PRIORITY_FILTERNAME, e);
		}
	}


To sync individual services, a URI may be supplied to the SyncManager. The default URIs when Portal is used are CAICatalog and CAIHierarchy.

public static void sync(String uri) {
		try {
			// for clarity, print out the sync units known to the manager
			for (String unit : syncManager.getSyncUnitUris()) {
				logger.info("Found Sync Unit " + unit);
			}

			jobId = syncManager.sync(new String[] { uri }, true);
		} catch (SyncException e) {
			logger.log(Level.SEVERE, "Error syncing", e);
		}
	}


Receiving Synchronization Events


It may be beneficial for other plugins to complete work based on synchronization events such as synchronization having just completed. Again, the SyncManager can be used. First add a listener and then create code to handle the received event. Both tasks are shown below.

// listen for events from synchronization
syncManager.addSyncEventListener(getDefaultListener());

private static SyncEventListener getDefaultListener() {
		return new SyncEventListener() {
			@Override
			public void receive(SyncEvent event) {
				logger.info("Sync Event Received "
						+ event.getEventType().toString());

				if (event.getEventContext() instanceof JobContext) {
					JobContext context = (JobContext) event.getEventContext();

					// check if the sync job we submitted matches the
					// event's job id and the event has completed
					if (jobId.getId().equals(context.getJobId().getId()) &&
							event.getEventType() == EventType.SYNC_COMPLETED_EVENT) {
						logger.info("User submitted synchronization has completed");
					}
				}
				// see infocenter for additional details
				// http://publib.boulder.ibm.com/infocenter/ledoc/v6r2/index.jsp?topic=/com.ibm.rcp.tools.doc.appdev/dataaccess_developingsyncmanagerapplogic.html
			}
		};
	}


The above code listens for all synchronization events and logs all the event's names such as SyncStarted or SyncCompleted. But the inner block uses the SyncJobId of the completed event to selectively find the actual synchronization job that was submitted. This is done by comparing the SyncEvent's SyncJobId ID with the SyncJobId that was obtained when the jobId = syncManager.sync(new String[] { uri }, true); was called. By comparing the SyncJobId IDs, you can do work only when that specific job has started, completed, or encountered an error.

Because of the way the synchronization code functions, it's likely much less error prone to simply call the syncAll method rather than individual SyncUnit URIs and listen for that job to complete. If you were to submit an incorrect (non-subordinate) URI, you'd find that the synchronization simply never occurs. For this reason, syncAll is preferred.

Synchronization Details


When the Client for Desktop is paired with a Portal server, the synchronization feature immediately activates. Once the user updates the Home Portal Account preference page, even if the Portal server is unavailable, the user should see the synchronization icon in the launcher (open button). The button can be removed programmatically as demonstrated in the sample code.

private static final String SYNCUI_ACTIVITY_ID = "com.ibm.rcp.syncui.activity.showSyncUI";

public static void updateEnablement(boolean enabled) {
		IWorkbenchActivitySupport support = PlatformUI.getWorkbench()
				.getActivitySupport();

		IActivityManager manager = support.getActivityManager();

		Set s = new HashSet(manager.getEnabledActivityIds());

		if (enabled) {
			s.add(SYNCUI_ACTIVITY_ID);
		} else {
			s.remove(SYNCUI_ACTIVITY_ID);
		}

		support.setEnabledActivityIds(s);
	}


Using the synchronization launcher allows the user to manually synchronize with the back-end. There are some finer points of synchronization that should be noted:

Synchronization updates may not be immediate. Users may notice a delay of up to one minute before seeing a Composite Application change in the UI despite changes having been made to the back-end server. This is due to caching on the client side. To compensate for this delay, end users should use the "Reload Application" button.



Portal administrators can reduce the cache timeout by specifying a different value using the portal.app.cache.expiration key in the WP ConfigService resource. The default is 60 seconds.
environment provider.

An inability to synchronize on startup has been resolved with APAR LO53899. Contact support regarding fix availability. Users on Expeditor 6.2.2 fix pack 1 will have this fix provided via the fix pack. Users can also elect to receive a prompt to immediately synchronize when the platform starts, which forces immediate synchronization during startup of older clients.








  • Actions Show Menu▼


expanded Attachments (0)
collapsed Attachments (0)
Edit the article to add or modify attachments.
expanded Versions (13)
collapsed Versions (13)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (13)Apr 13, 2011, 6:44:08 PM~Tip Desachekli  
12Apr 13, 2011, 2:30:18 PM~Tip Desachekli  
11Oct 5, 2010, 3:18:59 PM~Lily Minlusteretsi  IBM contributor
10Oct 5, 2010, 1:01:57 PM~Lily Minlusteretsi  IBM contributor
9Sep 20, 2010, 3:26:28 PM~Lily Minlusteretsi  IBM contributor
8Sep 15, 2010, 4:49:47 PM~Lily Minlusteretsi  IBM contributor
7Sep 15, 2010, 12:37:16 AM~Lily Minlusteretsi  IBM contributor
6Sep 15, 2010, 12:36:46 AM~Lily Minlusteretsi  IBM contributor
5Sep 15, 2010, 12:28:40 AM~Lily Minlusteretsi  IBM contributor
4Sep 8, 2010, 5:37:12 PM~Lily Minlusteretsi  IBM contributor
3Sep 8, 2010, 4:58:58 PM~Lily Minlusteretsi  IBM contributor
2Sep 8, 2010, 4:56:08 PM~Lily Minlusteretsi  IBM contributor
1Sep 8, 2010, 4:53:23 PM~Tip Desachekli  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedAbout
  • HCL Software
  • HCL Digital Solutions community
  • HCL Software Support
  • BlogsDigital Solutions blog
  • Community LinkHCL Software forums and blogs
  • About HCL Software
  • Privacy
  • Accessibility